import { request } from '../utils/request';

// 项目API服务
export const projectApi = {
  // 获取项目列表
  async getProjects(params) {
    return request({
      url: '/project/list',
      method: 'GET',
      data: params
    });
  },
  
  // 获取快速访问项目列表
  async getQuickAccessProjects() {
    return request({
      url: '/project/quick_access',
      method: 'GET'
    });
  },
  
  // 添加到快速访问
  async addQuickAccessProject(projectId) {
    return request({
      url: '/project/quick_access/add',
      method: 'POST',
      data: { projectId }
    });
  },
  
  // 从快速访问移除
  async removeQuickAccessProject(projectId) {
    return request({
      url: '/project/quick_access/remove',
      method: 'POST',
      data: { projectId }
    });
  },
  
  // 获取项目详情
  async getProjectDetail(projectId) {
    return request({
      url: '/project/detail',
      method: 'GET',
      data: { projectId }
    });
  },
  
  // 创建项目
  async createProject(data) {
    return request({
      url: '/project/create',
      method: 'POST',
      data
    });
  },
  
  // 更新项目
  async updateProject(projectId, data) {
    return request({
      url: '/project/update',
      method: 'POST',
      data: {
        projectId,
        ...data
      }
    });
  },
  
  // 删除项目
  async deleteProject(projectId) {
    return request({
      url: '/project/delete',
      method: 'POST',
      data: { projectId }
    });
  }
}; 